

#ifndef TEXTURELIBRARY_H
#define TEXTURELIBRARY_H

#include "SDLview.h"

#include <string>
#include <map>
#include "Vec4.h"

/* Texture class */

enum mipmap_modes 
{
	NO_MIPMAPS, 
	BUILD_MIPMAPS
};

enum texture_apply_modes
{
	TEXTURE_MODULATE,
	TEXTURE_REPLACE,
	TEXTURE_ADD,
	TEXTURE_COMBINE,
	TEXTURE_BLEND,
	TEXTURE_DECAL
};

class Texture 
{
		
	/* Note that the texture coords of the texture on the screen are oriented as follows:
	
	  (0,0) +--------+ (1,0)
	        |        |
	        |        | 
	        |        |
	  (0,1) +--------+ (1,1)
		
	 */
	
public:
	
	Texture();
	~Texture();
	
	void Load(std::string inFilename);
	void Apply() const;	
	GLuint GetTextureName() const;
	enum mipmap_modes mipmapmode;
	enum texture_apply_modes mode;
	
	Vec4 getRGBatUV(float u, float v);
	int getHeight();
	int getWidth();

private:
	
	struct SDL_Surface *m_image;
	
	GLuint TextureName;
	
	Uint32 getPixel(int x, int y);
	
};


#endif //TEXTURELIBRARY_H
